package com.xs.store.good.controller;

import com.xs.store.good.client.UserClient;
import com.xs.store.good.pojo.Good;
import com.xs.store.good.pojo.User;
import com.xs.store.good.service.GoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/good")
public class GoodController {

    @Autowired
    GoodService goodService;

    @Autowired
    UserClient userClient;

    @GetMapping("/list")
    public List<Good> list(){
        List<User> list=userClient.list();
        if(list.size()==0){
            System.out.println("没东西啊！！！搞啥");
        }
        return goodService.list();
    }
}
